<template>
  <div class="flex">
    <div class="w-80px">基本图形</div>
    <div @click="createdShape">1</div>
  </div>
</template>

<script setup>
import { fabric } from "fabric"

const props = defineProps({
  canvas: Object
})

console.log(props.canvas, "canvas")

const createdShape = () => {
  const rect = new fabric.Rect({
    left: 0,
    top: 0,
    fill: "red",
    width: 20,
    height: 20
  })
  props.canvas.add(rect)
}
</script>

<style></style>
